Script development environment
The CADMATIC script development environment allows you to write scripts in an Integrated Development Environment (IDE), using the Notepad++ third-party application. A complete installation includes a number of plugins. The development environment provides the following benefits:
- Syntax highlighting
 - Code auto-completion
 - Insert defines, externs, private symbols etc. via code snippet panel
 - Browse script elements using a tree view
 - Automatically displayed script extern reference
 - Compile .mac to .bs
 
Installation
Prerequisites
- 
                                                                        
You have installed Notepad++ from https://notepad-plus-plus.org/. The version recommended to download is 7.8.5 32-bit version or newer.
Note: There is a 64-bit version and a 32-bit version, and not all plugins are available for both versions.
 
Do the following:
- 
                                                                        
In the CADMATIC installation package, browse to the folder tools\ScriptDeveloperSuite.
 - 
                                                                        
Run the file Installer.exe. The Cadmatic Script Environment dialog opens.
 - 
                                                                        
In the Notepad++ section, the program should automatically have detected where Notepad++ is installed on your computer. Otherwise, select the executable file and configuration directory manually.
- 
                                                                                
Notepad++ Config Directory – Select %APPDATA%\Notepad++
 
 - 
                                                                                
 - 
                                                                        
In the Plugins to install section, select which of the following plugins to install. Some of them are only available for the 32-bit version of Notepad++.
The plugins will be located in the following directories: Config Plugins directory in %APPDATA%\Notepad++\plugins\configand Plugins directory in C:\Program Files (x86)\Notepad++\plugins and C:\Program Files\Notepad++\plugins.
- 
                                                                                
Cadmatic – Allows configuring the compiler options and compiling scripts.
 - 
                                                                                
NppExec – A third-party plugin that allows executing commands and scripts from a console window.
 - 
                                                                                
NppSnippets – A third-party plugin that allows inserting code snippets.
 - 
                                                                                
SnippetPlus (32-bit only) – A third-party plugin that allows inserting code snippets and surrounding the snippet with other code.
 - 
                                                                                
SourceCookifier (32-bit only) – A third-party plugin that parses the currently displayed script file and allows browsing the contents using a tree view.
Note: If you cannot install this plugin because you are installing the 64-bit version of Notepad++, you can list the function definitions of the currently displayed macro file by selecting View > Function List in Notepad++.
The installer installs also the following Notepad++ configuration files:
- 
                                                                                        
Cadmatic.xml – It provides autocompletion and context information for CADMATIC symbols (externs, defines, intrinsics).
 - 
                                                                                        
userDefineLang.xml – CADMATIC language is added to this file. It provides syntax highlighting.
 - 
                                                                                        
functionList.xml – An embedded functionality of newer versions of Notepad++ to display all the functions (or method) found in the current file
 - 
                                                                                        
Cadmatic.ini – Contains the selected configuration directory, workstation profile, profile info, input, out-put.
 - 
                                                                                        
Cadmatic.Includes.ini – Maps a function with the CADMATIC script file in which it is defined.
 
 - 
                                                                                        
 
 - 
                                                                                
 - 
                                                                        
Click Install.
 - 
                                                                        
When the installation is completed, click OK and close the installer.
 - 
                                                                        
If you want to debug code with TRAP() in the 64-bit version of Notepad++, add the following environment variables to PMS_ROOT_DIR\<computer>.stc\wsprofile\cadm_nt.prf:
CopyPMS_TRAP_EDITOR=Notepad++.exe
PMS_TRAP_EDITOR_CMD_FORMAT=-n%d %s - 
                                                                        
Open Notepad++. You should see the following:
- 
                                                                                
Toolbar displays buttons for the installed plugins.
                                                                                - 
                                                                                        
Clicking
  shows the CADMATIC script compiler configuration. - 
                                                                                        
Clicking
 compiles the current file, generating the output file (.bs) in the same folder than the current file (input file). 
 - 
                                                                                        
 - 
                                                                                
Menu bar contains new items:
- 
                                                                                        
Language > Cadmatic – Select this to enable CADMATIC scripts to display proper syntax highlighting.
 - 
                                                                                        
Plugins > Cadmatic, and all other plugins you selected to install.
 
 - 
                                                                                        
 
 - 
                                                                                
 - 
                                                                        
Select Plugins > Cadmatic > Script Compiler Config. The compiler configuration dialog opens.
 - 
                                                                        
Define the following settings:
- Configuration directory – Click Browse and select the PMS_ROOT_DIR\<computer>.stc folder.
 - Workstation profile – Select your profile file.
 - Profile Info – These fields are automatically populated based on your profile file. You cannot edit them here.
 - Input – Select the CADMATIC script file (.mac, .asy) to be compiled.
 - Output – Select the folder where you want the .bs file to be output.
 
 - 
                                                                        
To compile the specified script now, click Compile.
The compilation output, when the compile process is completed successfully:
                                                                        The compilation output, when the compilation process has errors:
                                                                        To view details on the errors, click on the specific line and Notepad++ will jump to that file and line.
 - 
                                                                        
Click Save, then Close.
 
Creating and editing snippets with SnippetPlus
Note: This plugin is available only in 32-bit version.
Creating a snippet
- 
                                                                        
To open snippet editor, select Plugins > SnippetPlus > Show GUI Editor.
                                                                         - 
                                                                        
Enter snippet details, snippet code, and possible language modifications. Click Close.
                                                                         
Editing a snippet
- 
                                                                        
To open snippet editor, select Plugins > SnippetPlus > Show GUI Editor.
                                                                         - 
                                                                        
Select the library from Snippets.
                                                                         - 
                                                                        
Select the snippet from the list for editing. Make changes and click Close.
                                                                         
Creating libraries and snippets with Snippets
Note: Snippets plugin is available in 32-bit and 64-bit version.
Adding a library
- 
                                                                        
Right-click on top of the library list and select New library.
                                                                         - 
                                                                        
Add details for the library. Click OK.
                                                                        The library is added to the list.
                                                                         
Editing a library
- 
                                                                        
Right-click on top of the library list and select Edit library.
                                                                         - 
                                                                        
Edit library details and click OK.
                                                                         
Adding a snippet
- 
                                                                        
Right-click on snippet list and select Add.
                                                                         - 
                                                                        
Add the snippet details including name, before and after cursor details. Click OK.
                                                                        The new snippet will be added on the snippet list.